//
//  IncubationSpaceMessageView.m
//  BigToBig
//
//  Created by yi liu on 16/8/8.
//  Copyright © 2016年 cn.cloudtp. All rights reserved.
//

#import "IncubationSpaceMessageView.h"

@implementation IncubationSpaceMessageView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubViews];
    }
    return self;
}

- (void)createSubViews{
    
    // 头像
    self.headImageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, (kScreenWidth - 20)/6, (kScreenWidth - 20)/6)];
    [self addSubview:self.headImageView];
    self.headImageView.center = CGPointMake(self.headImageView.width / 2 + 10, 50);
    self.headImageView.layer.cornerRadius = (kScreenWidth - 20)/12;
    self.headImageView.layer.masksToBounds = YES;
    
    // 编辑按钮
    self.editButton = [UIButton buttonWithType:UIButtonTypeSystem];
    self.editButton.frame = CGRectMake(kScreenWidth - 10 - self.headImageView.width / 2, self.headImageView.y, self.headImageView.width / 2, self.headImageView.width / 2);
    [self addSubview:self.editButton];
    [self.editButton setImage:[UIImage imageNamed:@"edit"] forState:UIControlStateNormal];
    self.editButton.tintColor = [UIColor lightGrayColor];
    
    // 姓名
    self.nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.headImageView.maxX + 10, self.headImageView.y, kScreenWidth / 2 - self.headImageView.maxX - 10, self.headImageView.height /3)];
    self.nameLabel.textAlignment = NSTextAlignmentLeft;
    [self addSubview:self.nameLabel];
    
    // 固定资产
    self.capitalLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.nameLabel.x, self.nameLabel.maxY, self.nameLabel.width, self.nameLabel.height)];
    self.capitalLabel.textAlignment = NSTextAlignmentLeft;
    self.capitalLabel.textColor = [UIColor lightGrayColor];
    self.capitalLabel.font = [UIFont systemFontOfSize:12];
    [self addSubview:self.capitalLabel];
    
    
    // 主营业务
    self.bussinessLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.capitalLabel.x, self.capitalLabel.maxY + 2, kScreenWidth / 2, self.headImageView.width / 7 * 2)];
    self.bussinessLabel.font = [UIFont systemFontOfSize:12];
    self.bussinessLabel.textColor = [UIColor lightGrayColor];
    [self addSubview:self.bussinessLabel];
    
    
    
    // 分类名
    self.groupLabel = [[UILabel alloc]initWithFrame:CGRectMake(kScreenWidth - self.headImageView.width - 20, self.bussinessLabel.y, self.headImageView.width + 10, self.headImageView.width / 3)];
    _groupLabel.backgroundColor = COLOR_RGBA(0, 228, 161, 1);
    _groupLabel.font = [UIFont systemFontOfSize:12];
    _groupLabel.textAlignment = 1;
    _groupLabel.textColor = [UIColor whiteColor];
    _groupLabel.layer.cornerRadius = 5;
    _groupLabel.layer.masksToBounds = YES;
    [self addSubview:_groupLabel];
    
   }

@end
